/***************************************************************************
 *  Filename: remoteprocess.cpp
 *  Class: RemoteProcess
 *
 *  Copyright 2012  Xander van Kooten
 *  <xandervk@gmail.com>
 *
 *  Copyright 2012  Mario Henrique Voorsluys
 *  <forcaeluz@gmail.com>
 *
 ****************************************************************************/

/*
 *
 * This file is part of Parsax-Remote-Controller.
 *
 *    Parsax-Remote-Controller is free software: you can redistribute it
 *    and/or modify it under the terms of the GNU General Public License
 *    as published by the Free Software Foundation, either version 3 of the
 *    License, or (at your option) any later version.
 *
 *    Parsax-Remote-Controller is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with Parsax-Remote-Controller.
 *    If not, see <http://www.gnu.org/licenses/>.
 */

#include "remoteprocess.h"
#include <QDebug>
RemoteProcess::RemoteProcess(QObject *parent) :
    QObject(parent)
{
}

void RemoteProcess::setId(QString tid){
    emit infoUpdated();
    myid = tid;
}

void RemoteProcess::setPc(QString pc){
    emit infoUpdated();
    mypc = pc;
}

void RemoteProcess::setProgram(QString tprogram){
    emit infoUpdated();
    program = tprogram;
}

void RemoteProcess::setParameters(QStringList tparameters){
    emit infoUpdated();
    foreach(QString str, tparameters){
        if(str==""){
            tparameters.removeAll(str);
        }
    }

    parameters = tparameters;
}

void RemoteProcess::setStatus(QString tstatus){
    qDebug() << "[RemoteProcess] Status updated";
    status = tstatus;
    emit infoUpdated();
}

QString RemoteProcess::getId(){
    return myid;
}

QString RemoteProcess::getPc(){
    return mypc;
}

QString RemoteProcess::getProgram(){
    return program;
}

QString RemoteProcess::getParametersString(){
    return parameters.join(" ");
}

QStringList RemoteProcess::getParameters(){
    return parameters;
}

QString RemoteProcess::getStatus(){
    return status;
}

void RemoteProcess::startProcess(){
    qDebug() << "[RemoteProcess] Start the process please";
    emit startMe(myid);
}

void RemoteProcess::stopProcess(){
    emit stopMe(myid);
}

void RemoteProcess::newCloReceived(int type, QString message){
    emit cloReceived(type, message);
}
